﻿using CtPlc.Pandi.ColumbusSystemMaintenance.Models;
using FluentNHibernate.Mapping;

namespace CtPlc.Pandi.ColumbusSystemMaintenance.Mapping
{
    public class CoverageTemplateMap : ClassMap<CoverageTemplate>
    {
        public CoverageTemplateMap()
        {
            Table("GLCoverageTemplate");

            Id(x => x.Id).Column("TemplateId");
            Map(x => x.TemplateName).Not.Nullable();
            Map(x => x.TemplateRemarks).Not.Nullable();
            Map(x => x.ClubId).Not.Nullable();
            Map(x => x.BusinessClassId).Not.Nullable();
            Map(x => x.BusinessTypeId).Not.Nullable();
            Map(x => x.SpecialistAllowed).Column("SpecialistAllowedYN");
            Map(x => x.ContractualCoveragesAllowed).Column("ContractualCoveragesAllowedYN");
            Map(x => x.EffectiveDate).Not.Nullable();
            Map(x => x.ExpiryDate);
            Map(x => x.CreatedBy).Not.Nullable();
            Map(x => x.CreatedOn).Not.Nullable();
            
            References(x => x.Club).Columns("ClubId").Not.Insert().Not.Update().Not.LazyLoad();
            References(x => x.LookupBusinessClass).Columns("BusinessClassId").Not.Insert().Not.Update().Not.LazyLoad();
            References(x => x.LookupBusinessType).Columns("BusinessTypeId").Not.Insert().Not.Update().Not.LazyLoad();
        }
    }
}